-
Notifications
You must be signed in to change notification settings - Fork 136
Replace system::time::Duration with std::time::Duration
#1207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Replace system::time::Duration with std::time::Duration
#1207
Conversation
src/sudoers/policy.rs
Outdated
| prior_validity: Duration::from_secs(self.timestamp_timeout().try_into().unwrap()), | ||
| pwfeedback: self.pwfeedback(), | ||
| password_timeout: match self.passwd_timeout() { | ||
| password_timeout: match self.passwd_timeout().try_into().unwrap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no validation in fractional_minutes that no negative numbers are used by the user, so this unwrap can trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it, so it uses the default value of passwd_timeout when triggering the unwrap. Is this also a problem for prior_validity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should already fail in the config parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too familiar with the code, what is the config parser and should only passwd_timeout fail when negative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 88 in 5bcad63
| fn fractional_minutes(input: &str) -> Option<i64> { |
562b268 to
9f08633
Compare
9f08633 to
928dd57
Compare
This pull request replaces
system::time::Durationwithstd::time::Duration.I couldn't find any code that still uses negative duration, so I replaced it with it's
stdequivalent.The only place, where I'm not sure if its possible to use an negative duration, is the
prior_validityproperty from theAuthenticationstruct.Should close #1170